package com.ffcs.cn.action.base.checkbox;

import com.supermap.desktop.core.ui.controls.GridBagConstraintsHelper;
import org.jetbrains.userdefine.ui.speedSearch.SimpleColoredComponent;

import javax.swing.*;
import java.awt.*;

/**
 * 简单的带checkbox的渲染项
 */
public class PanelSimpleCheck extends JPanel {
	private JCheckBox checkBox = new JCheckBox();
	private SimpleColoredComponent labelText = new SimpleColoredComponent();

	public PanelSimpleCheck(ComboBoxSelectableDataItem comboBoxSelectableDataItem) {
		this.checkBox.setSelected(comboBoxSelectableDataItem.isSelected());
		this.checkBox.setBorder(BorderFactory.createEmptyBorder());
		this.labelText.setText(comboBoxSelectableDataItem.getValue());

		setLayout(new GridBagLayout());
		this.add(this.checkBox, new GridBagConstraintsHelper(0, 0, 1, 1).setInsets(0, 0).setFill(GridBagConstraints.NONE).setAnchor(GridBagConstraintsHelper.WEST));
		this.add(this.labelText, new GridBagConstraintsHelper(1, 0, 1, 1).setInsets(0, 0).setFill(GridBagConstraints.NONE).setAnchor(GridBagConstraintsHelper.WEST));
		this.add(new JLabel(), new GridBagConstraintsHelper(3, 0, 1, 1).setInsets(0, 0).setFill(GridBagConstraints.HORIZONTAL).setAnchor(GridBagConstraintsHelper.WEST).setWeight(1, 1));

		setBorder(BorderFactory.createEmptyBorder());
	}


}
